<template>
  <Submenu :name="`${parentName}`">
    <template slot="title">
      <!-- <common-icon :type="parentItem.icon || ''"/> -->
      <div class="flex flex-y-center">
      <img :src="parentItem.icon + '.png'" class="ml10 " alt="" />
      <span class="ml10">{{ showTitle(parentItem) }}</span>
      </div>
    </template>
    <template v-for="item in children">
      <template v-if="item.children && item.children.length === 1">
        <side-menu-item
          v-if="showChildren(item)"
          :key="`menu-${item.name}`"
          :parent-item="item"
        ></side-menu-item>
        <menu-item
          v-else
          :name="getNameOrHref(item, true)"
          :key="`menu-${item.children[0].name}`"
        >
          <!-- <common-icon :type="item.children[0].icon || ''"/> -->
          <!-- {{item.meta.icon}} -->
          <div class="flex flex-y-center">
            <img :src="item.meta.icon + '.png'" class="ml10" alt="" />
            <span class="ml10">{{ showTitle(item.children[0]) }}</span>
          </div>
        </menu-item>
      </template>
      <template v-else>
        <side-menu-item
          v-if="showChildren(item)"
          :key="`menu-${item.name}-il`"
          :parent-item="item"
        ></side-menu-item>
        <menu-item
          v-else
          :name="getNameOrHref(item)"
          :key="`menu-${item.name}-chl`"
          style="background:#000940"
        >
          <!-- <common-icon :type="item.icon || ''"/> -->
          <!-- {{item.meta.icon}} -->
          <div class="flex flex-y-center">
            <!-- <img :src="item.meta.icon + '.png'" class="ml10" alt="" /> -->
            <span class="ml20">{{ showTitle(item) }}</span>
          </div>
        </menu-item>
      </template>
    </template>
  </Submenu>
</template>
<script>
import mixin from './mixin'
import itemMixin from './item-mixin'
export default {
  name: 'SideMenuItem',
  mixins: [mixin, itemMixin]
}
</script>
